package com.neo.springcloud.alibaba.controller;

import com.neo.springcloud.alibaba.domain.CommonResult;
import com.neo.springcloud.alibaba.service.AccountService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @ClassName: AccountController
 * @Title: cloud2021
 * @Package: com.neo.springcloud.alibaba.controller
 * @Description:
 * @Author: Kisen
 * @Date: 2021/11/25 22:52
 */
@RestController
public class AccountController {

    @Resource
    private AccountService accountService;

    /**
     * 扣减账户余额
     *
     * @param userId
     * @param money
     * @return
     */
    @RequestMapping("/account/decrease")
    public CommonResult decrease(Long userId, BigDecimal money) {
        accountService.decrease(userId, money);
        return new CommonResult(200, "扣减账户余额成功！");
    }

}
